home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / returnto.zip / SETRETRN.BAT < prev   
DOS Batch File  |  1993-04-06  |  3KB  |  62 lines

  1. @echo off
  2. rem  SETRETRN
  3. rem -------------------------------------------------- ==Bruce M. Bowman == ---
  4. rem  runprogr.BAT, SETRETRN.BAT, and DORETURN.BAT -- for running a program from
  5. rem  any starting drive:\directory and returning to that drive:\directory;
  6. rem  it is assumed that the program run is one that must be run from its own
  7. rem  directory or is not in a PATH'd directory
  8. rem
  9. rem  [These batch files were derived from item in PC Magazine, June 26, 1990
  10. rem  (Vol. 9, No. 12).  RETURNTO.ZIP--RUNPROGR.BAT, SETRETRN.BAT, DORETURN.BAT]
  11. rem ---------------------------------------------------------------------------
  12. rem  SETRETRN - 1) This batch file creates a batch file ZZZZZZZ1.BAT that has
  13. rem                one line, viz.:  prompt cd $p
  14. rem             2) It then executes that batch file as at the end of this file
  15. rem                to produce a 4-line batch file ZZZZZZZ2.BAT that will be
  16. rem                as below if the starting drive and directory are, for
  17. rem                example, C: and \UTILS:
  18. rem                                    (line 1, blank)
  19. rem                C: xprompt cd $p    (line 2)
  20. rem                                    (line 3, blank)
  21. rem                cd C:\UTILS         (line 4)
  22. rem
  23. rem             3) The ZZZZZZZ2.BAT file will be used by DORETURN.BAT to reset
  24. rem                the starting drive and directory after completion of an
  25. rem                applications batch execution in which the drive and
  26. rem                directory are changed.
  27. rem
  28. rem  EXAMPLE APPLICATIONS BATCH FILE (runprogr.BAT)
  29. rem
  30. rem                @ECHO OFF
  31. rem                rem  EXAMPLE APPLICATIONS BATCH FILE (runprogr.BAT)
  32. rem                rem
  33. rem                rem  Run QEDIT from C:\UTILS *and return to the starting
  34. rem                rem  drive and directory*.
  35. rem                rem
  36. rem                rem  If DOS version is earlier than 3.3, delete @ and
  37. rem                rem  substitute COMMAND /C for CALL in this batch file.
  38. rem                rem  The batch files SETRETRN.BAT and DORETURN.BAT must
  39. rem                rem  be in a PATH'd directory.  *This* file (runprogr.BAT)
  40. rem                rem  must also be in a PATH'd directory.
  41. rem                rem
  42. rem                rem  "runprogr" can be a name of your choosing and
  43. rem                rem  "MYPROGRM" is the name of the applications program
  44. rem                rem  to run; e.g., "runprogr.BAT" = "EDIT.BAT" and
  45. rem                rem  "MYPROGRM" = "QEDIT".
  46. rem                rem
  47. rem                CALL SETRETRN
  48. rem                C:
  49. rem                CD \UTILS
  50. rem                QEDIT %1
  51. rem                CALL DORETURN
  52. rem
  53. rem ---------------------------------------------------------------------------
  54. rem  If ZZZZZZZ1.BAT and ZZZZZZZ2.BAT can be written to and executed from *any*
  55. rem  convenient drive and directory.  Here, they are in the C:\ root directory.
  56. rem  The batch files SETRETRN.BAT, DORETURN.BAT, and runprogr.BAT must be in
  57. rem  a PATH'd directory.
  58. echo prompt cd $p>c:\zzzzzzz1.bat
  59. prompt $n: x
  60. command /c c:\zzzzzzz1.bat >c:\zzzzzzz2.bat
  61. prompt $p$g
  62.